 package tools.packet;

 import client.MapleCharacter;
 import client.MapleClient;
 import client.inventory.Item;
 import handling.opcode.InteractionOpcode;
 import handling.opcode.SendPacketOpcode;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import server.MapleTrade;
 import tools.data.output.MaplePacketLittleEndianWriter;








 public class TradePacket
 {
/*  22 */   private static final Logger log = LogManager.getLogger(TradePacket.class);




   public static byte[] getTradeInvite(MapleCharacter chr) {
/*  28 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/*  29 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/*  31 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/*  32 */     mplew.write(InteractionOpcode.交易邀请.getValue());
/*  33 */     mplew.write(4);
/*  34 */     mplew.writeMapleAsciiString(chr.getName());
/*  35 */     mplew.writeInt(0);
/*  36 */     mplew.writeInt(0);
/*  37 */     return mplew.getPacket();
   }




   public static byte[] getTradeMesoSet(byte number, long meso) {
/*  44 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/*  45 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/*  47 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/*  48 */     mplew.write(InteractionOpcode.设置金币.getValue());
/*  49 */     mplew.write(number);
/*  50 */     mplew.writeLong(meso);

/*  52 */     return mplew.getPacket();
   }




   public static byte[] getTradeItemAdd(byte number, Item item) {
/*  59 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/*  60 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/*  62 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/*  63 */     mplew.write(InteractionOpcode.设置物品.getValue());
/*  64 */     mplew.write(number);
/*  65 */     mplew.write(item.getPosition());
/*  66 */     PacketHelper.addItemInfo(mplew, item);

/*  68 */     return mplew.getPacket();
   }





   public static byte[] getTradeStart(MapleClient c, MapleTrade trade, byte number) {
/*  76 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/*  77 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/*  79 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/*  80 */     mplew.write(InteractionOpcode.房间.getValue());
/*  81 */     mplew.write(4);
/*  82 */     mplew.write(2);
/*  83 */     mplew.write(number);
/*  84 */     if (number == 1) {
/*  85 */       mplew.write(0);
/*  86 */       PacketHelper.addCharLook(mplew, trade.getPartner().getChr(), true, trade.getPartner().getChr().isZeroSecondLook());
/*  87 */       mplew.writeMapleAsciiString(trade.getPartner().getChr().getName());
/*  88 */       mplew.writeShort(trade.getPartner().getChr().getJob());
     }
/*  90 */     mplew.write(number);
/*  91 */     PacketHelper.addCharLook(mplew, c.getPlayer(), true, c.getPlayer().isZeroSecondLook());
/*  92 */     mplew.writeMapleAsciiString(c.getPlayer().getName());
/*  93 */     mplew.writeShort(c.getPlayer().getJob());
/*  94 */     mplew.write(255);

/*  96 */     return mplew.getPacket();
   }

   public static byte[] getTradeConfirmation() {
/* 100 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/* 101 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 103 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/* 104 */     mplew.write(InteractionOpcode.确认交易.getValue());

/* 106 */     return mplew.getPacket();
   }

   public static byte[] TradeMessage(byte number, byte message) {
/* 110 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/* 111 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 113 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/* 114 */     mplew.write(InteractionOpcode.退出.getValue());
/* 115 */     mplew.write(number);









/* 125 */     mplew.write(message);

/* 127 */     return mplew.getPacket();
   }





   public static byte[] getTradeCancel(byte number, int message) {
/* 135 */     log.info("调用"+Thread.currentThread().getStackTrace()[1].getMethodName());
/* 136 */     MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

/* 138 */     mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
/* 139 */     mplew.write(InteractionOpcode.退出.getValue());
/* 140 */     mplew.write(number);
/* 141 */     mplew.write((message == 0) ? 2 : 9);

/* 143 */     return mplew.getPacket();
   }
 }


/* Location:              C:\PGX\Server.jar!\tools\packet\TradePacket.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */